﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeBehind="TrailSearch2.aspx.cs" Inherits="Imageo.ui.TrailSearch2" %>

<%@ Register Src="../controls/TrailTable.ascx" TagName="TrailTable" TagPrefix="bintje" %>
<%@ Register Src="../controls/ImageTable.ascx" TagName="ImageTable" TagPrefix="bintje" %>
<%@ Register Src="../controls/ImgZoomDlg.ascx" TagName="ZoomImg" TagPrefix="bintje" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContentPlaceholder" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceholder" runat="Server">
    <asp:Panel ID="pnlMyTrails" runat="server" Style="text-align: left;">
        <div style="float: left; padding: 5px 5px 5px 5px;">
            <span id="spanReferenceTrail" runat="server" style="font: 18px/18px Arial, Helvetica, sans-serif;
                font-weight: bold; color: #20afe0;">Search Results</span>
        </div>
        <asp:UpdatePanel runat="server">
            <ContentTemplate>
                <div style="clear: both">
                    <asp:ListView ID="ListView2" runat="server" DataSourceID="ObjectDataSource1">
                        <EmptyDataTemplate>
                            <table id="Table1" runat="server" width="100%">
                                <tr>
                                    <td>
                                        <div style="width: 100%; height: 400px; vertical-align: middle;" align="center">
                                            <div class="detailBoxes" style="width: 200px; height: 40px;">
                                                <span class="ErrorMessage">No trails were found</span></div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <LayoutTemplate>
                            <table id="tblLayout" runat="server" width="100%">
                                <tr id="Tr1" runat="server">
                                    <td id="Td1" runat="server">
                                        <table id="groupPlaceholderContainer" width="100%" runat="server" style="font-family: Verdana, Arial, Helvetica, sans-serif;
                                            vertical-align: top;">
                                            <tr runat="server" id="rowSortHeaders" valign="top">
                                                <td width="160px">
                                                    <asp:LinkButton ID="lnkSortByTitle" runat="server" OnClick="lnkSortByTitle_Click">Title</asp:LinkButton>
                                                    <asp:Image ID="imgDownTitle" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpTitle" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="200px" valign="top">
                                                    <asp:LinkButton ID="lnkSortByDescription" runat="server" OnClick="lnkSortByDescription_Click">Description</asp:LinkButton>
                                                    <asp:Image ID="imgDownDescription" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpDescription" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="90px" valign="top">
                                                    <asp:LinkButton ID="lnkSortByCity" runat="server" OnClick="lnkSortByCity_Click">City</asp:LinkButton>
                                                    <asp:Image ID="imgDownCity" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpCity" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="90px" valign="top">
                                                    <asp:LinkButton ID="lnkSortByCountry" runat="server" OnClick="lnkSortByCountry_Click">Country</asp:LinkButton>
                                                    <asp:Image ID="imgDownCountry" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpCountry" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="90px" align="center" valign="top">
                                                    <asp:LinkButton ID="lnkSortByLength" runat="server" OnClick="lnkSortByLength_Click">Length</asp:LinkButton>
                                                    <asp:Image ID="imgDownLength" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpLength" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="100px" align="center">
                                                    <asp:LinkButton ID="lnkSortByLayer" runat="server" OnClick="lnkSortByLayer_Click">Layer</asp:LinkButton>
                                                    <asp:Image ID="imgDownLayer" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpLayer" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="90px" align="center">
                                                    <asp:LinkButton ID="lnkSortByAddedBy" runat="server" OnClick="lnkSortByAddedBy_Click">Added By</asp:LinkButton>
                                                    <asp:Image ID="imgDownAddedBy" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpAddedBy" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="90px" align="center">
                                                    <asp:LinkButton ID="lnkSortByAddedOn" runat="server" OnClick="lnkSortByAddedOn_Click">Added On</asp:LinkButton>
                                                    <asp:Image ID="imgDownAddedOn" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpAddedOn" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="100px" align="center">
                                                    <asp:LinkButton ID="lnkSortByWaypoints" runat="server" OnClick="lnkSortByWaypoints_Click">Waypoints</asp:LinkButton>
                                                    <asp:Image ID="imgDownWaypoints" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpWaypoints" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                                <td width="80px" align="center">
                                                    <asp:LinkButton ID="lnkSortByVisits" runat="server" OnClick="lnkSortByVisits_Click">Visits</asp:LinkButton>
                                                    <asp:Image ID="imgDownVisits" Visible="false" runat="server" ImageUrl="~/images/down.png" />
                                                    <asp:Image ID="imgUpVisits" Visible="false" runat="server" ImageUrl="~/images/up.png" />
                                                </td>
                                            </tr>
                                            <tr valign="top" runat="server" id="rowTableHeaders" class="blueSmallTitle">
                                                <td width="160px">
                                                    Title
                                                </td>
                                                <td width="200px" valign="top">
                                                    Description
                                                </td>
                                                <td width="90px" valign="top">
                                                    City
                                                </td>
                                                <td width="90px" valign="top">
                                                    Country
                                                </td>
                                                <td width="90px" align="center" valign="top">
                                                    Length
                                                </td>
                                                <td width="100px" align="center">
                                                    Layer
                                                </td>
                                                <td width="90px" align="center">
                                                    Added By
                                                </td>
                                                <td width="90px" align="center">
                                                    Added On
                                                </td>
                                                <td width="100px" align="center">
                                                    Waypoints
                                                </td>
                                                <td width="80px" align="center">
                                                    Visits
                                                </td>
                                            </tr>
                                            <tr id="groupPlaceholder" runat="server" valign="top">
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr id="Tr2" runat="server">
                                    <td id="Td2" runat="server" style="text-align: center; background-color: #5D7B9D;
                                        font-family: Verdana, Arial, Helvetica, sans-serif;">
                                        <asp:DataPager ID="DataPager1" runat="server" PageSize="5">
                                            <Fields>
                                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
                                                    ShowPreviousPageButton="False" />
                                                <asp:NumericPagerField />
                                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
                                                    ShowPreviousPageButton="False" />
                                            </Fields>
                                        </asp:DataPager>
                                    </td>
                                </tr>
                            </table>
                        </LayoutTemplate>
                        <EmptyItemTemplate>
                            <td id="Td3" runat="server" />
                        </EmptyItemTemplate>
                        <ItemTemplate>
                            <td colspan="10">
                                <hr />
                                <div style="width: 100%;">
                                    <a href="../ui/TrailDetails.aspx<%# Eval("OpenTrailUrl") %>" style="text-align: left">
                                        <%# Eval("Title") %>
                                    </a>(<a href="TrailSearch2.aspx<%# Eval("SearchSimilarTrailUrl") %>" style="<%# Eval("DisplaySimilarTrailOption") %>  font-size: 10px;">
                                        Find similar trails </a><a href="TrailSearch2Img.aspx<%# Eval("SearchSimilarImageUrl") %>" style="<%# Eval("DisplaySimilarImageOption") %>  font-size: 10px;">
                                            - Find similar images</a> )
                                </div>
                           </td>
                            </tr>
                            <tr>
                                <td>
                                    <bintje:ZoomImg runat="server" ID="zimgPicture" Width="150" Height="85" ImageUrl='<%# Eval("ImageUrl") %>'
                                        OpenTrailUrl='<%# Eval("OpenTrailUrl") %>' SearchSimilarTrailUrl='' SearchSimilarImageUrl='' />
                                    <div style="clear: both; font-size: 10px;">
                                    </div>
                                </td>
                                <td valign="top">
                                    <%# Eval("description") %>
                                </td>
                                <td valign="top">
                                    <%# Eval("city") %>
                                </td>
                                <td valign="top">
                                    <%# Eval("country") %>
                                </td>
                                <td align="center" valign="top">
                                    <%# Eval("length") %>
                                </td>
                                <td align="center" valign="top">
                                    <%# Eval("layers") %>
                                </td>
                                <td align="center" valign="top">
                                    <%# Eval("addedBy") %>
                                </td>
                                <td align="center" valign="top">
                                    <%# Eval("addedOn") %>
                                </td>
                                <td align="center" valign="top">
                                    <%# Eval("waypoints") %>
                                </td>
                                <td align="center" valign="top">
                                    <%# Eval("visits") %>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <GroupTemplate>
                            <tr id="itemPlaceholderContainer" runat="server" valign="top">
                                <td id="itemPlaceholder" runat="server">
                                </td>
                            </tr>
                        </GroupTemplate>
                    </asp:ListView>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="Imageo.TrailDataSourceObject"
                        SelectMethod="SelectTrails" EnablePaging="True" SelectCountMethod="SelectTrailsCount">
                        <SelectParameters>
                            <asp:SessionParameter Name="currentSession" SessionField="bintjeSession" Type="Object" />
                            <asp:SessionParameter Name="sortField" SessionField="sortField" Type="String" />
                            <asp:QueryStringParameter Name="searchString" QueryStringField="SearchStr" Type="String" />
                            <asp:QueryStringParameter Name="imageIdStr" QueryStringField="imageId" Type="String" />
                            <asp:QueryStringParameter Name="trailIdStr" QueryStringField="trailId" Type="String" />
                            <asp:QueryStringParameter Name="proUserIdStr" QueryStringField="prouserid" Type="String" />
                            <asp:QueryStringParameter Name="userIdStr" QueryStringField="userId" Type="String" />
                            <asp:QueryStringParameter Name="latitudeStr" QueryStringField="latitude" Type="String" />
                            <asp:QueryStringParameter Name="longitudeStr" QueryStringField="longitude" Type="String" />
                            <asp:SessionParameter Name="sortDirection" SessionField="sortDirection" Type="String" />
                            <asp:Parameter DefaultValue="0" Name="startRowIndex" Type="Int32" />
                            <asp:Parameter DefaultValue="20" Name="maximumRows" Type="Int32" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>
</asp:Content>
